#pragma once

#include "GameObject.h"
#include "PhysicObject.h"
#include "FatPointer.h"
#include "Tracer.h"

#include <allegro.h>
#include <Box2D/Box2D.h>
#include <vector>
#include <cstdlib>
#include <stdio.h>
#include <string>
#include <algorithm>


class Model
{
public:
	Model(void);
	~Model(void);

	static Model* getModel(){ return instance; };

	DATAFILE* data;
	b2World *world;
	b2Vec2 *gravity;

	std::vector <GameObject *> activeObjects;
	std::vector <GameObject *> passiveObjects;
	std::vector < FatBase<void> *> listeners;

	void parseDataFile(const char *filename);
	void addListener(FatBase<void> *ls);
	void sendMessage(GameObject *& o);
	GameObject *& addPassiveObject(GameObject *o);
	GameObject *& addActiveObject(GameObject *o);
protected:
	static Model * instance;
	BITMAP * loadToVid(BITMAP *bmp);
};
